<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <!-- 解构 -->
    <script>
        var dic = {name: "cc" , age: "19",skill: "vue",
        s:{
            sex:"male"
        }
    }
    var{ name,skill,age,s} = dic; //顺序可以变
    console.log(name,skill,age,s.sex)
    </script>

    
    <script>
        var obj =[
            {name:"cheng",age:18,skill:"vue"},
            {name:"li",age:17,skill:"js"},
            {name:"zhang",age:16,skill:"html"},
        ]
        /* arr=[{name:"xx",skill:"xx"},{name:"xx",skill:"xx"}] */
        var  arr = [];
        for(var i=0;i<obj.length;i++){
            // 普通方式
            /*var name = obj[i].name;
            var skill = obj[i].skill;*/
            // 解构方式
            var{name,skill} = obj[i];

            
            arr.push({
                name:name,
                skill:skill
            })
        }
        console.log(arr);
    </script>
</body>
</html>